local RuleLayer = class("RuleLayer", function(scene)
		local ruleLayer = display.newLayer(cc.c4b(0, 0, 0, 125))
    return ruleLayer
end)

local PopWait = appdf.req(appdf.CLIENT_SRC.."app.views.layer.other.PopWait")
local ExternalFun = appdf.req(appdf.EXTERNAL_SRC .. "ExternalFun")
local ClipText = appdf.req(appdf.EXTERNAL_SRC .. "ClipText")
local MultiPlatform = appdf.req(appdf.EXTERNAL_SRC .. "MultiPlatform")



function RuleLayer:ctor(textName)

	
	self._textName = textName

	self:setContentSize(yl.WIDTH,yl.HEIGHT)


--
--	local  btcallback = function(ref, type)
--        if type == ccui.TouchEventType.ended then
--         	this:onButtonClickedEvent(ref:getTag(),ref)
--        end
--    end
	
	local  rootLayer, csbNode = ExternalFun.loadRootCSB("public/ruleLayer.csb", self)
	csbNode:getChildByName("Button_1")
			:addTouchEventListener(function (ref,type)
				if type == ccui.TouchEventType.ended then
					self:setVisible(false)
					ref:setScale(1)
				elseif type == ccui.TouchEventType.began then
					ref:setScale(yl.btscale)
					return true
				elseif type == ccui.TouchEventType.canceled then  
					ref:setScale(1)
				end
			end)
			
	local ruleData = cc.FileUtils:getInstance():getStringFromFile("rule/"..textName..".txt");
--	local ruleData = "撒地方阿斯蒂芬撒地方阿道夫阿斯蒂芬阿斯蒂芬而为全额人情味瓜娃儿地方问题问题额撒地方阿斯蒂芬撒地方阿道夫阿斯蒂芬阿斯蒂芬而为全额人情味瓜娃儿地方问题问题额"
	local contentListView = csbNode:getChildByName("ruleListView")
	local ruleInfo_text = ccui.Text:create("","fonts/round_body.ttf",28)
	ruleInfo_text:ignoreContentAdaptWithSize(false)
	ruleInfo_text:setColor(cc.c3b(0,0,0))
	ruleInfo_text:setTextAreaSize(cc.size(767,0))
	ruleInfo_text:setString(tostring(ruleData))
	ruleInfo_text:move(300,300)
	local rendSize = ruleInfo_text:getVirtualRendererSize()
	ruleInfo_text:setSize(rendSize)
--	self:addChild(ruleInfo_text,100)
	contentListView:pushBackCustomItem(ruleInfo_text)

end
return RuleLayer

